package com.zx.notification.common.param;

import com.zx.validation.annotation.ParameterValidation;
import com.zx.validation.enums.ValidateRulesEnum;
import com.zx.validation.groups.Query;
import com.zx.validation.groups.StatusUpdate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * <p>
 * description: 站内信阅读记录参数 <br>
 * create: 2025-10-17
 * </p>
 *
 * @author zhou  xun
 */
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class InboxReadRecordsParam implements Serializable, StatusUpdate, Query {
    /**
     * 记录ID
     */
    private String id;

    /**
     * 通知ID
     */
    private String notificationId;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 阅读状态: UNREAD,READ
     */
    private String readStatus;

    /**
     * 阅读时间
     */
    private LocalDateTime readTime;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;


    /**
     * 创建时间开始
     * 用于时间范围查询，查询大于等于该时间的记录
     */
    private LocalDateTime createTimeStart;

    /**
     * 创建时间结束
     * 用于时间范围查询，查询小于等于该时间的记录
     */
    private LocalDateTime createTimeEnd;
    /**
     * 当前页码
     */
    @ParameterValidation(index = 0, desc = "当前页码", rules = {ValidateRulesEnum.NUMBER_MIN}, numberMin = 1)
    private Long pageNum;

    /**
     * 每页条数
     */
    @ParameterValidation(index = 0, desc = "每页条数", rules = {ValidateRulesEnum.NUMBER_MIN, ValidateRulesEnum.NUMBER_MAX}, numberMin = 1, numberMax = 1000)
    private Long pageSize;

    @Override
    public Set<String> getStatusUpdateGroupFields() {
        return Set.of("id", "readStatus");
    }

    @Override
    public Set<String> getQueryGroupFields() {
        return Set.of("notificationId", "userId", "readStatus", "pageNum", "pageSize",
                "createTimeStart", "createTimeEnd");
    }
}